<!-- 公告页面2.0 -->
<template>
  <div class="notice animate__animated animate__zoomIn">
    <div v-if="!loadingFlag" class="notice-title">
      <dv-decoration-11
        style="width: 25%; height: 80%;font-size: 0.26rem"
        >公告详情</dv-decoration-11
      >
      <div class="goback">
        <GoBack></GoBack>
      </div>
    </div>
    <div v-if="!loadingFlag" class="notice-info">
      <dv-border-box-3>
        <div class="info-box">
          <div class="info-title">
            <h1>{{title}}</h1>
          </div>
          <div class="info-content">
            <div id="notiveInfo" v-html="info"></div>
          </div>
        </div>
      </dv-border-box-3>
    </div>
    <!-- loading -->
    <div v-if="loadingFlag" class="e-loading">
      <dv-loading style="color: #fff; opcity: 0.5"
        >数据加载中...</dv-loading
      >
    </div>
  </div>
</template>

<script>
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      title: "关于【qwe】的公告",
        info: "123",
        loadingFlag: true,
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    async init() {
      let id = this.$route.params.id
      console.log('等待接口，获取ID为'+id+'的公告详情');
      
      let ret = await this.$http.postGetTalkingDetail({id})
      if (ret.data.errorCode != 0) {
        return console.log('后台报错');
      }

      let data = ret.data.data
      console.log(data);
      this.title = data.title
      this.info = data.content

      this.loadingFlag = false
    }
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {
    // console.log(this.$route.params.id + " 是ID");
    this.init()
  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
};
</script>
<style lang='less' scoped>
//@import url(); 引入公共css类
.notice {
  width: 100%;
  height: 100%;
  .notice-title {
    width: 100%;
    height: 15%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    color: @FontColor;
    .goback {
      position: absolute;
      left: 0;
      top: 2%;
    }
  }
  .notice-info {
    width: 70%;
    height: 85%;
    margin: 0 auto;
    position: relative;
    .info-box {
      width: 90%;
      height: 90%;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%,-50%);
      background-color: rgba(255,255,255,.1);
      border-radius: 0.08rem;
      padding: 1% 2%;
      .info-title {
        width: 100%;
        height: 20%;
        border-bottom: 1px solid #ccc;
        display: flex;
        justify-content: center;
        align-items: center;
        h1 {
          font-size: 0.34rem;
          color: @FontColor;
        }
      }
      .info-content {
        height: 70%;
        padding: 4% 2%;
        // background-color: #ccc;
        #notiveInfo {
          // background-color: pink;
          color: #eee;
          box-sizing: border-box;
          padding: 0 5%;
          width: 100%;
          height: 100%;
          font-size: 0.28rem;
          text-align: left;
          line-height: 1.5;
          text-indent:2em;
          overflow: auto;
        }
      }
    }
  }
}
</style>